package com.example.xxtautosignjava.controller;


import com.example.xxtautosignjava.common.R;
import com.example.xxtautosignjava.entity.IndexChoice;
import com.example.xxtautosignjava.service.IndexChoiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lee
 * @since 2022-08-16
 */
@RestController
@RequestMapping("/xxtautosignjava/index-choice")
public class IndexChoiceController {

    @Autowired
    IndexChoiceService indexChoiceService;

    @GetMapping("getchoice")
    public R getChoice(){
        List<IndexChoice> list = indexChoiceService.list();
        IndexChoice[] indexChoices=new IndexChoice[list.size()];
//         for (int i = 0; i < list.size(); i++) {
//             indexChoices[i].setId(list.get(i).getId());
//            indexChoices[i].setIndexUrl(list.get(i).getIndexUrl());
//            indexChoices[i].setIndexTitle( list.get(i).getIndexTitle());
//        }

        return R.ok().data("choice",list)   ;
    }
}

